<!DOCTYPE html>
<html lang="en">
<html xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">
    <title>About Us</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <link href="css/font-awesome.min.css" rel="stylesheet">
    <link href="css/pe-icons.css" rel="stylesheet">
    <link href="css/prettyPhoto.css" rel="stylesheet">
    <link href="css/animate.css" rel="stylesheet">
    <link href="css/style.css" rel="stylesheet">
    <link href="css/mycss.css" rel="stylesheet">
    <link rel="stylesheet" href="css/hotelSku.css">
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->
    <script src="js/jquery.js"></script>

    <style type="text/css">
        html,body{margin:0;padding:0;}
        .iw_poi_title {color:#CC5522;font-size:14px;font-weight:bold;overflow:hidden;padding-right:13px;white-space:nowrap}
        .iw_poi_content {font:12px arial,sans-serif;overflow:visible;padding-top:4px;white-space:-moz-pre-wrap;word-wrap:break-word}
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?key=&v=1.1&services=true"></script>

    <link rel="shortcut icon" href="images/ico/favicon.ico">
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="images/ico/apple-touch-icon-144x144.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="images/ico/apple-touch-icon-114x114.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="images/ico/images/ico/apple-touch-icon-72x72.png">
    <link rel="apple-touch-icon-precomposed" href="images/ico/apple-touch-icon-57x57.png">




    <script type="text/javascript">
        jQuery(document).ready(function($){
            'use strict';
            jQuery('body').backstretch([
                "images/bg/bg1.jpg",
                "images/bg/bg2.jpg",
                "images/bg/bg3.jpg"
            ], {duration: 5000, fade: 500});


        });
    </script>
</head><!--/head-->
<body>
<div id="preloader"></div>
<div th:replace="index :: header"></div>

<section id="single-page-slider" class="no-margin">
    <div class="carousel slide" data-ride="carousel">
        <div class="carousel-inner">
            <div class="item active">
                <div class="container">
                    <div class="row">
                        <div class="col-md-12">
                            <div class="center gap fade-down section-heading">
                                <h2 class="main-title">热门酒店预订</h2>
                                <hr>
                                <p>Hot hotel reservations</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div><!--/.item-->
        </div><!--/.carousel-inner-->
    </div><!--/.carousel-->
</section><!--/#main-slider-->

<div id="content-wrapper">
    <section id="blog" class="white">
        <div class="container">
            <div class="gap"></div>
            <div class="row">
                <aside class="col-sm-4 col-sm-push-8">
                    <!--<div class="widget search">-->
                        <!--<form role="form">-->
                            <!--<div class="input-group">-->
                                <!--<input type="text" class="form-control" autocomplete="off" placeholder="Search">-->
                                <!--<span class="input-group-btn">-->
                                        <!--<button class="btn btn-primary btn-outlined" type="button"><i class="fa fa-search"></i></button>-->
                                    <!--</span>-->
                            <!--</div>-->
                        <!--</form>-->
                    <!--</div>&lt;!&ndash;/.search&ndash;&gt;-->

                    <div class="widget categories">
                        <h3 class="widget-title">酒店特色</h3>
                        <div class="row">
                            <div class="col-sm-6">
                                <ul class="arrow">
                                    <li><a href="#">时尚</a></li>
                                    <li><a href="#">独特设计</a></li>
                                    <li><a href="#">音乐伴奏</a></li>
                                    <li><a href="#">超大高尔夫球场</a></li>
                                    <li><a href="#">美丽草坪</a></li>
                                </ul>
                            </div>
                            <div class="col-sm-6">
                                <ul class="arrow">
                                    <li><a href="#">美丽湖畔</a></li>
                                    <li><a href="#">便捷旅游</a></li>
                                    <li><a href="#">超大游泳池</a></li>
                                    <li><a href="#">便捷交通</a></li>
                                    <li><a href="#">临近地铁站</a></li>
                                </ul>
                            </div>
                        </div>
                    </div><!--/.categories-->
                    <div class="widget tags">
                        <h3 class="widget-title">酒店分类</h3>
                        <ul class="tag-cloud">
                            <li th:each = "classifi,classfiState:${hotelSaleAttrs}"><a class="btn btn-xs btn-primary btn-outlined" href="#" th:text="${classifi.getSaleAttrName()}"></a></li>
                        </ul>
                    </div><!--/.tags-->
                    <div class="widget tags">
                        <h3 class="widget-title">服务类型</h3>
                        <ul class="tag-cloud">
                            <th:block th:each = "classifications:${hotelSaleAttrs}">
                                <li th:each = "classifi:${classifications.getHotelSaleAttrValues()}">
                                    <a class="btn btn-xs btn-primary btn-outlined" href="#" th:text="${classifi.getHotelSaleAttrValue()}">含早餐</a>
                                </li>
                            </th:block>
                        </ul>
                    </div><!--/.tags-->
<!--                    <div class="widget tags">-->
<!--                        <h3 class="widget-title">服务详细</h3>-->
<!--                        <ul class="tag-cloud">-->
<!--                            <li><a class="btn btn-xs btn-primary btn-outlined" href="#">含早餐</a></li>-->
<!--                            <li><a class="btn btn-xs btn-primary btn-outlined" href="#">可退</a></li>-->
<!--                            <li><a class="btn btn-xs btn-primary btn-outlined" href="#">免押金</a></li>-->
<!--                            <li><a class="btn btn-xs btn-primary btn-outlined" href="#">提供热水</a></li>-->
<!--                            <li><a class="btn btn-xs btn-primary btn-outlined" href="#">闪住</a></li>-->
<!--                        </ul>-->
<!--                    </div>&lt;!&ndash;/.tags&ndash;&gt;-->

                </aside>
                <div class="col-sm-8 col-sm-pull-4">
                    <div class="blog">
<!--                        <div class="blog-item">-->
<!--                            <div class="blog-featured-image">-->
<!--                                <img class="img-responsive img-blog" src="http://192.168.153.250/group1/M00/00/00/wKiZ-l35-VyATXJvAANrV8rmWro192.jpg" alt="" />-->
<!--                                <div class="overlay">-->
<!--                                    <a class="preview btn btn-outlined btn-primary" href="blog-item.html" rel="prettyPhoto"><i class="fa fa-link"></i></a>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                            <div class="blog-content">-->
<!--                                <a href="blog-item.html"><h3 class="main-title">攀枝花阳光团结大酒店</h3></a>-->
<!--                                <div class="entry-meta">-->
<!--                                    <span><i class="fa fa-user"></i> <a href="#">可单人/多人</a></span>-->
<!--                                    <span><i class="fa fa-folder"></i> <a href="#">超大房型</a></span>-->
<!--                                    <span><i class="fa fa-clock-o"></i> 2019年12月24日</span>-->
<!--                                    <span><i class="fa fa-comment"></i> <a href="blog-item.html#comments"><span class="counter">14</span> Comments</a></span>-->
<!--                                </div>-->
<!--                                <p>攀枝花阳光大酒店、是及餐饮，住宿，娱乐等多功能为一体的综合性酒店，内置许多的房型，比如大床房，特价房，以及尊贵的总统套房，为您提供最优质的服务！</p>-->
<!--                                <div class="read-more-wrapper">-->
<!--                                    <a class="btn btn-outlined btn-primary" href="blog-item.html">了解更多</a>-->
<!--                                </div>-->
<!--                            </div>-->
<!--                        </div>&lt;!&ndash;/.blog-item&ndash;&gt;-->


                        <div class="blog-item" th:each = "item:${hotelItemSpus}">
                            <div class="blog-featured-image">
                                <img class="img-responsive img-blog" th:src="${item.getImags()[0].getHotelItemImagUrl()}" alt="" />
                                <div class="overlay">
                                    <a class="preview btn btn-outlined btn-primary" th:href="${item.getImags()[0].getHotelItemImagUrl()}" rel="prettyPhoto"><i class="fa fa-link"></i></a>
                                </div>
                            </div>
                            <div class="blog-content">
                                <a href="blog-item.html"><h3 class="main-title" th:text="${item.getHotelItemSpuName()}">攀枝花阳光团结大酒店</h3></a>
                                <div class="entry-meta">
                                    <span><i class="fa fa-user"></i> <a href="#">可单人/多人</a></span>
                                    <span><i class="fa fa-headphones"></i> <a href="#" th:text="${item.getHotelItemSpuTel()}">可单人/多人</a></span>
                                    <span><i class="fa fa-address-book"></i> <a href="#" th:text="${item.getHotelItemSpuAdress()}">超大房型</a></span>
                                    <span><i class="fa fa-clock-o"></i> 2020年2月2日</span>
                                    <span>类型: <a href="#" th:text="${item.getCategorizationInformationName()}">Comments</a></span>
                                    <span>评分: <a href="#" th:text="${item.getHotelItemSpuScore()}">Comments</a></span>
                                </div>
                                <p>攀枝花的综合性酒店、是及餐饮，住宿，娱乐等多功能为一体的综合性酒店，内置许多的房型，比如大床房，特价房，以及尊贵的总统套房，为您提供最优质的服务！</p>
                                <div class="read-more-wrapper">
                                    <button class="btn btn-outlined btn-primary learnMore" th:value = "${item.getId()}">了解更多</button>
                                    <button class="btn btn-outlined btn-primary immediateReservation" th:value = "${item.getId()}">立即预订</button>
                                    <button class="btn btn-outlined btn-primary showMap">查看地图</button>
                                </div>
                            </div>
                        </div>



                        <!--可以把这个当成一个摆设-->
                        <ul class="pagination pagination-lg">
                            <li><a href="#"><i class="fa fa-angle-left"></i></a></li>
                            <li class="active"><a href="#">1</a></li>
                            <li><a href="#">2</a></li>
                            <li><a href="#">3</a></li>
                            <li><a href="#">4</a></li>
                            <li><a href="#">5</a></li>
                            <li><a href="#"><i class="fa fa-angle-right"></i></a></li>
                        </ul><!--/.pagination-->
                    </div>
                </div><!--/.col-md-8-->
            </div><!--/.row-->
        </div>
    </section><!--/#blog-->
</div>

<!--设置一个模态框-->
<!-- 模态框（Modal） -->
<div class="modal fade" id="bookSku" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                <h3 style="color: #cccccc;font-weight: 600;" class="modal-title" id="myModalLabel">酒店预订</h3>
            </div>
            <div id="modelContent">
<!--                <div class="hotelSkuItem">-->
<!--                    <span class="spuName">攀枝花大酒店</span>-->
<!--                    <span class="skuName">温馨大大床房</span>-->
<!--                    <span class="skuPrice">￥199</span>-->
<!--                    <button type="button" class="bookBtn">立即预定</button>-->
<!--                </div>-->
<!--                <div class="hotelSkuItem">-->
<!--                    <span class="spuName">攀枝花大酒店</span>-->
<!--                    <span class="skuName">温馨大大床房</span>-->
<!--                    <span class="skuPrice">￥199</span>-->
<!--                    <button type="button" class="bookBtn">立即预定</button>-->
<!--                </div>-->
            </div>
        </div><!-- /.modal-content -->
    </div><!-- /.modal -->
</div>

<div th:replace="information :: Pagefoot"></div>


<script src="js/bootstrap.min.js"></script>
<script src="js/jquery.prettyPhoto.js"></script>
<script src="js/plugins.js"></script>
<script src="js/init.js"></script>
<script src="js/common.js"></script>
<script src="layui/layui.js"></script>

<script>
    $(function () {
        layui.use('layer', function(){
            var layer = layui.layer;
        });
       bindShowMapBtn();
       bindImmediateReservationBtn();
       bindLearnMoreBtn();
    });
    
    function bindLearnMoreBtn() {
        $(".learnMore").click(function () {
            var itemId = $(this).val();
            window.open("http://39.107.45.130/show_hotel_details?itemId="+itemId, "_blank");
        })
    }

    
    function bindImmediateReservationBtn() {
        $(".immediateReservation").click(function () {
            var spuId = $(this).val();
            $.get("get/sku/by/spuId",{"spuId":spuId},function (response) {
                //发送ajax获取请求。
                var data = response.data;
                $("#modelContent").empty();
                for (var i = 0 ; i < data.length ; i++){
                    var html = "<div class='hotelSkuItem'><span class='spuName'>"+data[i].hotelItemSpuName+"</span><span class='skuName'>"+data[i].hotelName+"</span><span class='skuPrice'>￥"+data[i].hotalCost+"</span><span class='skuPrice'>"+data[i].hotelItemSpuScore+"星</span><button skuId ="+data[i].id +" type='button' class='bookBtn'>立即预定</button></div>";
                    $("#modelContent").append(html);
                }
            });
            $("#bookSku").modal("show");
            bindBookBtn();
        });
    }

    function bindBookBtn() {
        $(".bookBtn").click(function () {
            var skuId = $(this).attr("skuId");
            if (userInfoObject.id == undefined){
                layer.msg("请登录之后操作！")
            }else {
                var userId = userInfoObject.id;
                $.get("add/book/hotel",{
                    "skuId":skuId,
                    "userId":userId
                },function (res) {
                    layer.msg(res.message);
                })
            }
        })
    }
    
    function bindShowMapBtn() {
        $('.showMap').on('click', function () {
            var imgUrl = $(this).attr("num");
            var html = $(".iframeMap").html();
            if (imgUrl == "") {
                imgUrl = "http://39.107.45.130:8001/group1/M00/00/00/rBHE-F5sPJSAIpJTAAb804eX_u4753.jpg";
            }
            layer.open({
                type: 1,
                area: ['1200px', '720px'],
                shadeClose: true, //点击遮罩关闭
                content: "<div style='width:1150px;height:680px;border:#ccc solid 1px;' id='dituContent'></div>"
            });
            initMap();//创建和初始化地图
        });
    }

    //创建和初始化地图函数：
    function initMap(){
        createMap();//创建地图
        setMapEvent();//设置地图事件
        addMapControl();//向地图添加控件
        addMarker();//向地图中添加marker
    }

    //创建地图函数：
    function createMap(){
        var map = new BMap.Map("dituContent");//在百度地图容器中创建一个地图
        var point = new BMap.Point(101.732177,26.573981);//定义一个中心点坐标
        map.centerAndZoom(point,17);//设定地图的中心点和坐标并将地图显示在地图容器中
        window.map = map;//将map变量存储在全局
    }

    //地图事件设置函数：
    function setMapEvent(){
        map.enableDragging();//启用地图拖拽事件，默认启用(可不写)
        map.enableScrollWheelZoom();//启用地图滚轮放大缩小
        map.enableDoubleClickZoom();//启用鼠标双击放大，默认启用(可不写)
        map.enableKeyboard();//启用键盘上下左右键移动地图
    }

    //地图控件添加函数：
    function addMapControl(){
        //向地图中添加缩放控件
        var ctrl_nav = new BMap.NavigationControl({anchor:BMAP_ANCHOR_TOP_LEFT,type:BMAP_NAVIGATION_CONTROL_LARGE});
        map.addControl(ctrl_nav);
        //向地图中添加缩略图控件
        var ctrl_ove = new BMap.OverviewMapControl({anchor:BMAP_ANCHOR_BOTTOM_RIGHT,isOpen:1});
        map.addControl(ctrl_ove);
        //向地图中添加比例尺控件
        var ctrl_sca = new BMap.ScaleControl({anchor:BMAP_ANCHOR_BOTTOM_LEFT});
        map.addControl(ctrl_sca);
    }

    //标注点数组
    var markerArr = [{title:"我的标记",content:"我的备注",point:"101.730785|26.57516",isOpen:0,icon:{w:21,h:21,l:0,t:0,x:6,lb:5}}
    ];
    //创建marker
    function addMarker(){
        for(var i=0;i<markerArr.length;i++){
            var json = markerArr[i];
            var p0 = json.point.split("|")[0];
            var p1 = json.point.split("|")[1];
            var point = new BMap.Point(p0,p1);
            var iconImg = createIcon(json.icon);
            var marker = new BMap.Marker(point,{icon:iconImg});
            var iw = createInfoWindow(i);
            var label = new BMap.Label(json.title,{"offset":new BMap.Size(json.icon.lb-json.icon.x+10,-20)});
            marker.setLabel(label);
            map.addOverlay(marker);
            label.setStyle({
                borderColor:"#808080",
                color:"#333",
                cursor:"pointer"
            });

            (function(){
                var index = i;
                var _iw = createInfoWindow(i);
                var _marker = marker;
                _marker.addEventListener("click",function(){
                    this.openInfoWindow(_iw);
                });
                _iw.addEventListener("open",function(){
                    _marker.getLabel().hide();
                })
                _iw.addEventListener("close",function(){
                    _marker.getLabel().show();
                })
                label.addEventListener("click",function(){
                    _marker.openInfoWindow(_iw);
                })
                if(!!json.isOpen){
                    label.hide();
                    _marker.openInfoWindow(_iw);
                }
            })()
        }
    }
    //创建InfoWindow
    function createInfoWindow(i){
        var json = markerArr[i];
        var iw = new BMap.InfoWindow("<b class='iw_poi_title' title='" + json.title + "'>" + json.title + "</b><div class='iw_poi_content'>"+json.content+"</div>");
        return iw;
    }
    //创建一个Icon
    function createIcon(json){
        var icon = new BMap.Icon("http://app.baidu.com/map/images/us_mk_icon.png", new BMap.Size(json.w,json.h),{imageOffset: new BMap.Size(-json.l,-json.t),infoWindowOffset:new BMap.Size(json.lb+5,1),offset:new BMap.Size(json.x,json.h)})
        return icon;
    }

</script>
</body>
</html>